 #!/usr/bin/env bash

# 复制/data/workspaces/myshixun/vim-text.txt 到家目录
if [ ! -f ~/vim_text.txt ];then
    echo "not found"
    exit
fi

# 复制86-88行，粘贴到末尾
tail -n3 ~/vim_text.txt |egrep "kylinsoft"  >/dev/null 2>&1
if [ $? -eq 0 ];then
	echo true
else
	echo false
fi

# 删除136-139行
egrep "panda" ~/vim_text.txt >/dev/null 2>&1
if [ $? -eq 0 ];then
	echo true
else
	echo false
fi

# 将文中所有john替换为jhon
egrep "john" ~/vim_text.txt >/dev/null 2>&1
if [ $? -eq 0 ];then
	echo true
else
	echo false
fi

# 在88行尾添加内容 I love china
sed -n '88p' ~/vim_text.txt|egrep "I love china" >/dev/null 2>&1
if [ $? -eq 0 ];then
	echo true
else
	echo false
fi

# 在90行末尾新添加一行内容 Love me, love my dog
sed -n '91p' ~/vim_text.txt|egrep "love my" >/dev/null 2>&1
if [ $? -eq 0 ];then
	echo true
else
	echo false
fi